<?php
/**
 * @Author: lianlianzan(13040@qq.com)
 * @Date:   2018-05-14 16:40:00
 * @Last Modified by:   zhaozilong
 * @Last Modified time: 2019-02-20 10:35:48
 */

namespace app\wechat_manage\model;
use app\common\model\BaseNew;

class EventVerify extends BaseNew {

    protected $_pk = 'id';
    protected $_order = 'vieworder';

	// 定义时间戳字段名
	protected $createTime = '';
	protected $updateTime = '';

	public function countSearch($map) {
		return $this->where($map)->count();
	}

	public function search($map, $limit='') {
		$data = $this->where($map)->order('create_time desc')->limit($limit)->select();
		$data = $data->toArray(); //转换为数组
		return $this->parseSearch($data);
	}

	protected function parseSearch($data) {
		$ftpWeb = config('app.ftp_web');
		$isopen_config = config('isopen_config');

		$list = $ids = $cardIds = $uids = array();
		foreach ($data as $key => $value) {
			//通用解析
			$value['create_time_show'] = date("Y-m-d H:i:s", $value['create_time']);
			//$value['cover'] = $value['cover'] ? $ftpWeb.$value['cover'] : '';
			//$value['status_show'] = $isopen_config[$value['status']];
			//通用解析

			$list[$value['id']] = $value;
			$ids[$value['id']] = $value['id'];
			$cardIds[$value['card_id']] = $value['card_id'];
			$uids[$value['uid']] = $value['uid'];
		}
		return array($list, $ids, $cardIds, $uids);
	}

	protected function parseInfo($info) {
		$ftpWeb = config('app.ftp_web');
		$isopen_config = config('isopen_config');

		//通用解析
		$info['create_time'] = date("Y-m-d H:i:s", $info['create_time']);
		//$info['cover'] = $info['cover'] ? $ftpWeb.$info['cover'] : '';
		//$info['status_show'] = $isopen_config[$info['status']];
		//通用解析

		return $info;
	}

}